package com.yq.reggie.common;

/**
 * 基于ThreadLocal编写的工具类，用于用户保存和获取id
 */

public class BaseContext {
    private static ThreadLocal<Long> threadLocal=new ThreadLocal<Long>();
    /**
     * 保存当前用户id
     */
    public static void setCurrentId(Long id){
        threadLocal.set(id);
    }
    /**
     * 获取当前用户id
     */
    public static Long getCurrentId(){
        return threadLocal.get();
    }

}
